/*
 * Copyright (C), 2016-2020, 苏宁易购电子商务有限公司
 * FileName: ${model}DaoImpl.java
 * Author:   ${author} 
 * Date:     ${date}
 * Description: //模块目的、功能描述      
 * History: //修改记录
 * <author>      <time>      <version>    <desc>
 * 修改人姓名             修改时间            版本号                  描述
 */
package ${daoimplpackage};

import java.util.List;
import java.util.Map;

import ${daopackageClass};
import ${dmopackageClass};
import com.suning.plsadm.util.db.AbstractDaoSupport;
import com.suning.plsadm.util.page.Limit;
import com.suning.framework.spring.Dao;

/**
 * 
 * 〈一句话功能简述〉<br>
 * 〈功能详细描述〉
 *
 * @author ${author}
 * @see [相关类/方法]（可选）
 * @since [产品/模块版本] （可选）
 */
@Dao("${lowercasemodel}Dao")
public class ${model}DaoImpl extends AbstractDaoSupport implements ${model}Dao {

    private static final String NAMESPACE = "${namespace}.";

    /*
     * (non-Javadoc)
     * @see ${daopackageClassDesc}getById(java.lang.Long)
     */
    @Override
    public ${model}Entity getById(Long id) {
        String sql = NAMESPACE + "get${model}ById";
        return (${model}Entity) getSqlSession().selectOne(sql, id);
    }

    /*
     * (non-Javadoc)
     * @see
     * ${daopackageClassDesc}save${model}(${dmopackageClass})
     */
    @Override
    public Boolean save${model}(${model}Entity ${lowercasemodel}) {
        String sql = NAMESPACE + "save${model}";
        return getSqlSession().insert(sql, ${lowercasemodel}) > 0 ? Boolean.TRUE : Boolean.FALSE;
    }

    /*
     * (non-Javadoc)
     * @see
     * ${daopackageClassDesc}modify${model}(${dmopackageClass})
     */
    @Override
    public Boolean modify${model}(${model}Entity ${lowercasemodel}) {
        String sql = NAMESPACE + "update${model}";
        return getSqlSession().update(sql, ${lowercasemodel}) > 0 ? Boolean.TRUE : Boolean.FALSE;
    }

    /*
     * (non-Javadoc)
     * @see ${daopackageClassDesc}remove${model}(java.lang.Long)
     */
    @Override
    public Boolean remove${model}(Long id) {
        String sql = NAMESPACE + "remove${model}";
        return getSqlSession().delete(sql, id) > 0 ? Boolean.TRUE : Boolean.FALSE;
    }

    /*
     * (non-Javadoc)
     * @see ${daopackageClassDesc}queryAll(java.util.Map)
     */
    @Override
    public List<${model}Entity> queryAll(Map<String, Object> condition) {
        String sql = NAMESPACE + "queryAll${model}";
        return getSqlSession().selectList(sql, condition);
    }

    /*
     * (non-Javadoc)
     * @see ${daopackageClassDesc}query${model}ByPage(java.util.Map,
     * com.suning.plsadm.util.page.Limit)
     */
    @Override
    public List<${model}Entity> query${model}ByPage(Map<String, Object> condition, Limit limit) {
        String sql = NAMESPACE + "query${model}ByPage";
        return (List<${model}Entity>) getSqlSession().selectPage(sql, condition, limit);
    }
}
